import QtQuick 1.0
//import ShellInvoker 1.0
import "../../../common/lib/kdeadmouseutils-build-desktop"


Rectangle {
    id: coverFlow
    height: 300
    width:  500
    y:100
    property int itemWidth: 400
    property int itemHeight: 500
    property variant dataProvider : MovieModel{}
    property ListModel listModel: dataProvider.model
    color:'#010101'
    Component {
	id: delegateCpt
	Rectangle {
	  color:'transparent'
	  id:rectItem
	  z: PathView.z
	  scale: PathView.iconScale
	  width: coverFlow.itemWidth
	  height: coverFlow.itemHeight
	  transform: Rotation {
	     id: rotation
	     origin.x: delegateCpt.width/2
	     origin.y: delegateCpt.height/2
	     axis.x: 0; axis.y: 1; axis.z: 0
	     angle: PathView.angle?PathView.angle:0
	 }
	 
	 
	 
	 
	 Image { 
	  id:imgEndroit
	  anchors.top:parent.top
	  anchors.horizontalCenter:parent.horizontalCenter
	  width:parent.width
	  height:parent.height/2
	  fillMode: Image.PreserveAspectFit
	  source: poster
	  smooth: true
	  
	 }
	 
	 Image { 
	  id:imgEnvers
	  anchors.top:imgEndroit.bottom
	  anchors.topMargin:5
	  anchors.horizontalCenter:parent.horizontalCenter
	  width:parent.width
	  height:parent.height/2
	  fillMode: Image.PreserveAspectFit
	  source: poster
	  smooth: true
	  
	 }
	 
	 Rectangle { 
	  id:cacheRect
	  anchors.top:imgEndroit.bottom
	  anchors.topMargin:5
	  anchors.horizontalCenter:parent.horizontalCenter
	  width:parent.width
	  height:imgEnvers.height+3
	  smooth: true
	  gradient: Gradient {
	      GradientStop { position: 0.0; color: 'transparent' }
	      GradientStop { position: 0.3; color: coverFlow.color }
	  }
	 } 
	  
	}
    }
    
    PathView {
      id: myPathView
      anchors.fill: parent

      preferredHighlightBegin: 0.5
      preferredHighlightEnd: 0.5
  
      focus: true
      interactive: true
      model: coverFlow.listModel
      delegate: delegateCpt
      Keys.onRightPressed: if (!moving && interactive) incrementCurrentIndex()
      Keys.onLeftPressed: if (!moving && interactive) decrementCurrentIndex()
      
      path: Path {
	  startX: 0
	  startY: coverFlow.height / 2
	  PathAttribute { name: "z"; value: 0 }
	  PathAttribute { name: "angle"; value: 60 }
	  PathAttribute { name: "iconScale"; value: 0.5 }
	  PathLine { x: coverFlow.width / 2; y: coverFlow.height / 2;  }
	  PathAttribute { name: "z"; value: 100 }
	  PathAttribute { name: "angle"; value: 0 }
	  PathAttribute { name: "iconScale"; value: 1.0 }
	  PathPercent { value: 0.1 }
	  PathLine { x: coverFlow.width; y: coverFlow.height / 2; }
	  PathAttribute { name: "z"; value: 0 }
	  PathAttribute { name: "angle"; value: -60 }
	  PathAttribute { name: "iconScale"; value: 0.5 }
	  PathPercent { value: 1 }
      }
    }
    
}
